< previous page page_714 next page >

Page 714
Listing 18.14. continued
    Set rdoQry = Nothing
    Set rdoRS = Nothing
    Set rdoCon = Nothing
    Set rdoEnv = Nothing
    '
End Sub
The code in Listing 18.14 first opens the data connection and then creates a parameterized query (note the ? that represents the parameter portion of the statement). Then the rdoParameter object is populated by using the Value and Type properties. Notice that it is not necessary to surround string parameters in single or double quotation marks. This is handled by the remote data source. Then the OpenResultset method is used to populate the dataset, and the MoveLast method is used to force the cursor to traverse the entire record collection. This ensures an accurate value for the Rowcount property of the rdoResultset. Finally, the results appear in a dialog box, as shown in Figure 18.14.
0714-01.jpg
Figure 18.14.
Viewing the rdoParameters properties.
Tip.gif
The code in Listing 18.14 uses the Type property of the rdoParameter object. This is not a required property when creating rdoParameter objects, but it is highly recommended. If no Type property is set, the remote data source makes a guess at the data type of the parameter. This can lead to unexpected errors. If you have a CHAR column in your table that contains a shoe size (8.5, 9, and so on), for example, and use this column in a parameterized query, it is possible that passing a value of 8 will be misinterpreted by the RDBMS as an integer or long value instead of a CHAR value.

That completes your tour of the RDO programming object collection.

 
< previous page page_714 next page >

If you like this book, buy it!